﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SportStore.Infrastructure.Abstract;
using System.Web.Security;
using SportStore.Framework;
using SportStore.Models.Entities;
using SportStore.Models.Concrete;
using SportStore.Models.Abstract;

namespace SportStore.Infrastructure.Concrete
{
    public class FormsAuthProvider : IAuthProvider
    {
        IRepository repository = new EFRepository();
        public bool Authenticate(string username, string password)
        {
            
            bool result = ((username=="admin") && (password=="1111"))?true:false;
            if (result)
            {
                User user = new User();
                Role r1 = new Role();
                r1.Name = "user";
                user.Roles.Add(r1);
                Product p1 = new Product();
                p1.ProductID=3;
                user.Products.Add(p1);
                SessionManager.User(user);
            }
            return result;
        }
    }
}